package com.iims.flowable.service;

import com.iims.flowable.flow.vo.CategoryVo;
import com.iims.flowable.flow.vo.ProcessInstanceRequest;
import com.iims.flowable.flow.vo.request.FlowSummaryQueryVo;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.runtime.ProcessInstance;

import java.util.List;

/**
 * @author fanpei
 * @date 2021-04-03 14:40
 */
public interface IFlowInstanceService {

    /**
     * 查询单一流程实例
     *
     * @param processInstanceId
     * @return
     */
    ProcessInstance getProcessInstanceById(String processInstanceId);

    /**
     * 查询单一历史流程实例
     *
     * @param processInstanceId
     * @return
     */
    HistoricProcessInstance getHistoricProcessInstanceById(String processInstanceId);

    /**
     * 启动流程实例
     *
     * @param processInstanceRequest
     */
    void start(ProcessInstanceRequest processInstanceRequest);

    /**
     * 删除流程实例
     *
     * @param processInstanceId
     * @param cascade
     * @param deleteReason
     */
    void delete(String processInstanceId, boolean cascade, String deleteReason);

    /**
     * 激活流程实例
     *
     * @param processInstanceId
     */
    void activate(String processInstanceId);

    /**
     * 挂起流程实例
     *
     * @param processInstanceId
     */
    void suspend(String processInstanceId);

    /**
     * 查询我的汇总流程任务列表
     *
     * @param flowSummaryQueryVo
     */
    List<CategoryVo> listMyInvolvedSummary(FlowSummaryQueryVo flowSummaryQueryVo);

    /**
     * 检查业务key对象是否在流程中
     *
     * @param businessKey
     * @return
     */
    boolean checkBusinessInFlow(String businessKey);
}
